public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Stack<Character> stack = new Stack<>();
        while (in.hasNextLine()) {
            String str = in.nextLine();
            stack.add(str.charAt(0));
            for(int i = 1; i < str.length(); i++) {
                if(stack.isEmpty()) {
                    stack.add(str.charAt(i));
                }
                else if(!stack.isEmpty() && stack.peek() != str.charAt(i)) {
                    stack.add(str.charAt(i));
                }else {
                    if(!stack.isEmpty()) {
                        stack.pop();
                    }
                }
            }
        }
        Stack<Character> stack1 = new Stack<>();
        int k = stack.size();
        for(int i = 0; i < k; i++) {
            stack1.add(stack.pop());
        }
        if(stack1.isEmpty()) {
             System.out.println(0);
         }else {
            while(!stack1.isEmpty()) {
                System.out.print(stack1.pop());
            }
         }
        
    }
}